package com.woniu.carrent.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.carrent.pojo.TNews;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TNewsMapper extends BaseMapper<TNews> {
    @Delete("delete from t_news where newsId=#{nid}")
    int deleteByNewsId(Integer nid);
    @Select("select n.*,u.`userName` as username from t_news n\n" +
            "join t_user u on n.`userId` = u.`userId`\n" +
            "where newsId=#{newsid}")
    TNews selectNews(Integer newsid);

}
